// 实现⼀个停⻋场，其具备“停⻋和取⻋”的功能
class park {
  constructor(max){
    this.max = max;
    this.carAmount = 0;
    this.carNumberList = [];
  }
  parking(carNumber){
    if(this.carAmount >= this.max){
      console.log('停车数量已满')
      return;
    }
    this.carAmount += 1;
    this.carNumberList = [...this.carNumberList,carNumber];
  }
  pickUp(carNumber){
    this.carAmount -= 1;
    this.carNumberList = this.carNumberList.filter(i => i !== carNumber);
  }
}
const Park1 = new park(100)
Park1.parking('沪A123123') // 停车
Park1.pickUp('沪A123123') // 取车